<template>
  <div>
    <button @click="dianji">搜索</button>
    <ul>
      <li v-for="(i, item) in arrnew" :key="item">{{ i }}</li>
    </ul>
  </div>
</template>
<script>
import zhongVue from "../zhongjian1.js";
export default {
  data() {
    return {
      borA: "鞋子种类",
      arr: ["阿迪鞋子", "耐克鞋", "李宁鞋", "乔丹鞋子"],
      arrnew: [],
    };
  },
  created() {
    this.Adianji();
  },
  methods: {
    Adianji() {
      zhongVue.$on("FunB", (message) => {
        this.borA = message;
      });
    },
    dianji() {
      this.arrnew = [];
      this.arr.forEach((item) => {
        if (this.borA) {
          if (item.indexOf(this.borA) != -1) {
            this.arrnew.push(item);
          }
        }
      });
    },
  },
};
</script>

